package com.financing.platform.dao.impl;

import java.util.List;
import com.financing.platform.dao.impl.BaseDaoImpl;
import com.financing.platform.dao.IFpFundMFDao;
import com.financing.platform.dto.FpFundMFDTO;
import com.financing.platform.util.SqlName;
import java.sql.SQLException;
import java.util.Collections;

import org.springframework.stereotype.Repository;

/**
 * @Description:实现类
 * @author caojiayao
 * @version 1.0
 * @created 
 */
@Repository("fpFundMF")
public class FpFundMFDaoImpl extends BaseDaoImpl implements IFpFundMFDao {
	
	@Override
	public FpFundMFDTO getFpFundMF(Integer id) {
		try{
			return (FpFundMFDTO)this.sqlMapClient.queryForObject(SqlName.fpFundMF,id);
		} catch (SQLException e) {
			log.error("get fpFundMF error:",e);
			return null;
		}
	}
	
	
	@Override
	public Integer insertFpFundMF(FpFundMFDTO dto) {
		try {
		     return (Integer) this.sqlMapClient.insert(SqlName.insertFpFundMF,dto);
		} catch (SQLException e) {
			log.error("add fpFundMF error:",e);
			return 0;
		}
	}

	
	@Override
	public Integer updateFpFundMF(FpFundMFDTO dto) {
		try {
			return (Integer) this.sqlMapClient.update(SqlName.updateFpFundMF, dto);
		} catch (SQLException e) {
			this.log.error("update fpFundMF error 1!",e);
			return 0;
		}
	}
	
	@Override
	public Integer delFpFundMF(Integer id) {
		try{
			 return (Integer) this.sqlMapClient.delete(SqlName.delFpFundMF, id);
		} catch (SQLException e) {
			log.error("del fpFundMF error:",e);
			return 0;
		}
	}
	
	@Override
	public List<FpFundMFDTO> listFpFundMF(FpFundMFDTO dto) {
		try {
			return (List<FpFundMFDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundMF, dto);
		} catch (SQLException e) {
			log.error("Query fpFundMF note list error !", e);
			return Collections.emptyList();
		}
	}
	
	@Override
	public List<FpFundMFDTO> listFpFundMFByPage(FpFundMFDTO dto) {
		try {
			return (List<FpFundMFDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundMFByPage, dto);
		} catch (SQLException e) {
			log.error("Query fpFundMF note list error !", e);
			return Collections.emptyList();
		}
	}
	
	
	public Integer countFpFundMF(FpFundMFDTO dto){
		try {
			return (Integer)this.sqlMapClient.queryForObject(SqlName.countFpFundMF, dto);
		} catch (SQLException e) {
			log.error("Query fpFundMF note list error !", e);
			return 0;
		}
	}
	
}
